class PrizeDrawingController < ApplicationController
  def index
    choose_meeting
    render :action => 'choose_meeting'
  end
  
  def choose_meeting
    @meetings = Meeting.find(:all)
  end
  
  def choose_winners
    meeting = Meeting.find(params[:meeting_id])
    attendees = Array.new meeting.attendees
    @winners = Array.new
    number_of_winners = params[:number_of_winners]
    
    number_of_winners.to_i.times {
      winner_index = rand attendees.length
      winner = attendees[winner_index]
      @winners << winner
      attendees.delete winner
    }  
  end
end
